<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:h="http://java.sun.com/jsf/html">

    <body>

        <ui:composition template="./Template.xhtml">

            <ui:define name="content">
                <h:form>
                    <p:outputPanel id="inputform">
                        <p:messages id="msg" showDetail="true" showSummary="true"/>
                        <h1 align="center">Place Your Order!</h1>
                        <h:panelGrid columns="2" cellpadding="3">
                            Customer Name
                            <h:inputText value="#{orderBean.customer}" required="true"
                                         requiredMessage="Please enter customer name"/>
                            Product
                            <p:autoComplete value="#{orderBean.product}" completeMethod="#{productBean.complete}"
                                            queryDelay="200" minQueryLength="0"
                                            widgetVar="p" onselect="p.search()" onclick="p.search()"
                                            forceSelection="true"
                                            required="true" requiredMessage="Please enter Product"/>

                            Required Date
                            <p:calendar value="#{orderBean.requiredDate}" showOn="both"
                                        required="true" requiredMessage="Please enter required date"
                                        mindate="#{productBean.today}" pattern="MMMM/dd/yyyy" navigator="true"
                                        readOnlyInputText="true"/>
                            <p/>
                            <h:panelGroup>
                                <p:commandButton action="#{orderBean.save}" value="Submit" update="inputform,msg"/>
                                <p:commandButton type="reset" value="Reset"/>
                            </h:panelGroup>
                        </h:panelGrid>
                    </p:outputPanel>
                </h:form>
            </ui:define>

        </ui:composition>

    </body>
</html>
